﻿using SlamDunk.ValueObjects.Enums;
using System;

namespace SlamDunk.MES.Domain.Entities.StockContext
{
    /// <summary>
    /// 入库单
    /// </summary>
    public class StockInOrder : StockOrder
    {
        #region # 构造器

        #region 00.无参构造器
        /// <summary>
        /// 无参构造器
        /// </summary>
        protected StockInOrder() { }
        #endregion

        #region 01.创建入库单据构造器
        /// <summary>
        /// 创建入库单据构造器
        /// </summary>
        /// <param name="orderNo">单据编号</param>
        /// <param name="orderName">单据名称</param>
        /// <param name="stockOrderClassId">库存单据类Id</param>
        /// <param name="sourceOrderType">源单据类型</param>
        /// <param name="sourceOrderId">源单据Id</param>
        /// <param name="sourceOrderName">源单据名称</param>
        /// <param name="targetStorageLocationType">目标储存位置类型</param>
        /// <param name="targetStorageLocationId">目标储存位置Id</param>
        /// <param name="targetStorageLocationName">目标储存位置名称</param>
        /// <param name="generateBarcode">是否生成条码</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        public StockInOrder(string orderNo, string orderName, Guid stockOrderClassId, SourceOrderType? sourceOrderType, string sourceOrderId, string sourceOrderName, StorageLocationType targetStorageLocationType, string targetStorageLocationId, string targetStorageLocationName, bool generateBarcode, Guid? facilityId, string description)
            : base(orderNo, orderName, stockOrderClassId, StockDirectionType.Input, sourceOrderType, sourceOrderId, sourceOrderName, facilityId, description)
        {
            this.TargetStorageLocationType = targetStorageLocationType;
            this.TargetStorageLocationId = targetStorageLocationId;
            this.TargetStorageLocationName = targetStorageLocationName;
            this.GenerateBarcode = generateBarcode;
        }
        #endregion

        #endregion

        #region # 属性

        #region 目标储存位置类型 —— StorageLocationType TargetStorageLocationType
        /// <summary>
        /// 目标储存位置类型
        /// </summary>
        public StorageLocationType TargetStorageLocationType { get; private set; }
        #endregion

        #region 目标储存位置Id —— string TargetStorageLocationId
        /// <summary>
        /// 目标储存位置Id
        /// </summary>
        public string TargetStorageLocationId { get; private set; }
        #endregion

        #region 目标储存位置名称 —— string TargetStorageLocationName
        /// <summary>
        /// 目标储存位置名称
        /// </summary>
        public string TargetStorageLocationName { get; private set; }
        #endregion

        #region 是否生成条码 —— bool GenerateBarcode
        /// <summary>
        /// 是否生成条码
        /// </summary>
        public bool GenerateBarcode { get; private set; }
        #endregion

        #endregion

        #region # 方法

        #region 修改入库单 —— void UpdateInfo(StorageLocationType targetStorageLocationType...
        /// <summary>
        /// 修改入库单
        /// </summary>
        /// <param name="targetStorageLocationType">目标储存位置类型</param>
        /// <param name="targetStorageLocationId">目标储存位置Id</param>
        /// <param name="targetStorageLocationName">目标储存位置名称</param>
        /// <param name="facilityId">工厂模型Id</param>
        /// <param name="description">描述</param>
        public void UpdateInfo(StorageLocationType targetStorageLocationType, string targetStorageLocationId, string targetStorageLocationName, Guid? facilityId, string description)
        {
            this.TargetStorageLocationType = targetStorageLocationType;
            this.TargetStorageLocationId = targetStorageLocationId;
            this.TargetStorageLocationName = targetStorageLocationName;

            base.UpdateInfo(facilityId, description);
        }
        #endregion

        #endregion
    }
}
